import * as path from 'path';
import { ClassSerializerInterceptor, Module } from '@nestjs/common';
import { APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
import { ConfigModule, ConfigService } from 'nestjs-config';
import { ScheduleModule } from '@nestjs/schedule';
import {MethodsModule} from "@src/modules/Methods/methods.module";
import {LoadModule} from "@src/modules/Load/load.module";
import {QueryModule} from "@src/modules/Query/query.module";

@Module({
  imports: [
    ScheduleModule.forRoot(),
    // 配置加载配置文件
    ConfigModule.load(path.resolve(__dirname, 'config', '**/!(*.d).{ts,js}'), {
      modifyConfigName: (name: string) => name.replace('.config', ''),
    }),
    MethodsModule,
    LoadModule,
    QueryModule
  ],
  controllers: [],
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useClass: ClassSerializerInterceptor,
    },
  ],
})
export class AppModule {}
